import {
  checkLogin
} from './auth.js'
new Vue({
  el: '#app',
  data: {
    IS_LOGIN: null,
    username: '',
    password: ''
  },
  async created() {
    this.IS_LOGIN = await checkLogin()
    if (this.IS_LOGIN != null) {
      location.href = '/pages/main.html'
    }
  },
  methods: {
    async login() {
      const res = await request.post('/manage/login',{
        username: this.username,
        password: this.password
      })
      localStorage.setItem('authtoken', res.data)
      location.href = '/pages/main.html'
    }
  }
})